# -*- coding: utf-8 -*-

import pandas
import requests
import re
from matplotlib import pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
# from sina来自新浪的外汇数据.分析 import analysis_amplitude_num

# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.font_manager import FontProperties

font = FontProperties(fname=r"C:\Windows\Fonts\simhei.ttf", size=14)

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D


def show_1D(data=[-1, 1],x=1 ):
    s = data
    # print(s)
    plt.title(u'条形图图示例', FontProperties=font)
    plt.hist(s, bins=100, color='r')#, c="red" , normed=True)
    plt.axvline(x=x, ls="-", c="green")  # 添加垂直直线
    plt.show()


def show_2D(data_x=[2, 1], data_y=[3, 2]):
    # xValue = list(range(0, 101))
    # yValue = [x * np.random.rand() for x in xValue]
    xValue = data_x
    yValue = data_y
    plt.title(u'散点图示例', FontProperties=font)

    plt.xlabel('x-value')
    plt.ylabel('y-label')
    # plt.scatter(x, y, s, c, marker)
    # x: x轴坐标
    # y：y轴坐标
    # s：点的大小/粗细 标量或array_like 默认是 rcParams['lines.markersize'] ** 2
    # c: 点的颜色
    # marker: 标记的样式 默认是 'o'
    plt.legend()

    plt.scatter(xValue, yValue, s=20, c="#ff1212", marker='o')
    plt.show()


def show_3D(x=[1, 2, 3], y=[1, 2, 3], z=[1, 2, 3],):
    # setup the figure and axes
    fig = plt.figure(figsize=(8, 3))
    ax1 = fig.add_subplot(121, projection='3d')
    ax2 = fig.add_subplot(122, projection='3d')

    # fake data
    _x = np.arange(4)
    _y = np.arange(5)
    _xx, _yy = np.meshgrid(_x, _y)
    x, y = _xx.ravel(), _yy.ravel()

    top = x
    y
    bottom = np.zeros_like(top)
    width = depth = 1

    ax1.bar3d(x, y, bottom, width, depth, top, shade=True)
    ax1.set_title('Shaded')

    ax2.bar3d(x, y, bottom, width, depth, top, shade=True)
    ax2.set_title('Not Shaded')

    plt.show()
    # shade = True / False    # ，使阴影可见 / 不可见。


if __name__ == '__main__':
    # 开盘    最低    最高    收盘
    pass
    show_1D()
    # print(amplitude_num())
    # show_one_dimensiona(analysis_amplitude_num()['所有的涨跌幅度'])
